/**
 *  登录成功提示跳转控制器
 */
import tem from './index.html';
class logInSuccessCtrl {
    constructor($scope,$rootScope,$location,$interval) {
      $scope.username = $rootScope.username;
      //倒计时
    var timer = $interval(function () {
        var _intervalSecond = $('.intervalSecond')
        var intervalSecond = _intervalSecond.html()
        intervalSecond--
        _intervalSecond.html(intervalSecond)
        if (intervalSecond === 0 || intervalSecond < 1) {
            $location.path('/index')
            $interval.cancel(timer)
        }
    }, 1000)
  }
}
logInSuccessCtrl.$inject = ['$scope','$rootScope','$location','$interval']
module.exports = angular.module('directive.loginSuccess', []).directive('loginSuccess', function() {
    return {
	    restrict: 'E',
	    replace:true,
	    template: tem,
	    controller: logInSuccessCtrl
  }
}).name